<template>
	<view>
		<button type="primary" @click="changeLogin()">切换组件显示</button>
		<login v-if="flag" :msg="msg" @myData="getMsg"></login>
		<view>{{getChildMsg}}</view>
		<button type="primary" @click="changeMsg()">给子组件传参</button>
		<top></top>
		<left></left>
	</view>
</template>

<script>
	// 导入组件
	import login from "../../components/Login.vue"
	import top from "../../components/top.vue"
	import left from "../../components/left.vue"
	export default {
		
		data() {
			return {
				num:100,
				flag:true,
				msg:"uniapp_hello!",
				getChildMsg:""
			}
		},
		methods: {
			changeLogin(){
				this.flag=!this.flag
			},
			changeMsg(){
				this.msg="我是父组件要传给子组件的值：helloWorld！"
			},
			getMsg(res){
				this.getChildMsg=res
				console.log(res)
			}
		},
		// 组件注册
		components:{
			login:login,
			top:top,
			left:left
		}
	}
</script>

<style>

</style>
